package com.thoughtworks.preuniversity.biblioteca;

/**
 * Created by padmavb on 6/12/14.
 */

//Job:Reads the book title which the customer want to return ,ask for library whether it is in the check out list or not.
public class ReturnBookMovie extends MenuOperation{

    private String jobOfClass;
    public ReturnBookMovie(String jobOfClass) {
        this.jobOfClass=jobOfClass;
    }

    @Override

    void doCorrespondingOperation(Library library) {

        UserInterface userInterface=new UserInterface();
        if(this.jobOfClass.equals("Return Book")){

            userInterface.displayMessage("Enter book title to return");

            String bookToReturn=userInterface.readBookTitle();

            library.returnBook(bookToReturn);
        }
        else{

            userInterface.displayMessage("Enter movie title to return");
            String movieToReturn=userInterface.readMovieTitle();

            library.returnMovie(movieToReturn);
        }

    }

    @Override
    String giveJobOfClass() {
        return jobOfClass;
    }
}
